package androidgame.teslawars.game.maps;

import java.util.ArrayList;

import androidgame.teslawars.game.FootSoldier;
import androidgame.teslawars.game.ForestTile;
import androidgame.teslawars.game.Level;
import androidgame.teslawars.game.MountainTile;
import androidgame.teslawars.game.PlainTile;
import androidgame.teslawars.game.Tank;
import androidgame.teslawars.game.Tile;
import androidgame.teslawars.game.Unit;



public class Map2 extends Level {

	public Map2(LevelListener listener) {
		super(listener);
		this.worldWidth = 12;
		this.worldHeight = 9;
		grid = new Tile[worldWidth][worldHeight];
		for (int i = 0; i < worldWidth; i++) {
			for (int j = 0; j< worldHeight; j++) {
				if ((i * j * j + 23) % 12 < 4) { 
					grid [i][j] = new ForestTile(i,j);
				} else {
					grid[i][j] = new PlainTile(i,j);
				}
				if (Math.random() < .10)
					grid[i][j] = new MountainTile(i,j);
			}
		}
				
		player1UnitList = new ArrayList<Unit>(4);
		player1UnitList.add(new FootSoldier(0,3, Player.PLAYER1));
		player1UnitList.add(new FootSoldier(2,5, Player.PLAYER1));
		player1UnitList.add(new FootSoldier(0,7, Player.PLAYER1));
		player1UnitList.add(new Tank(0,5, Player.PLAYER1));
		player2UnitList = new ArrayList<Unit>(4);
		player2UnitList.add(new FootSoldier(worldWidth-1,3, Player.PLAYER2));  //coords are written thus to make it easier to mirror player1's units
		player2UnitList.add(new FootSoldier(worldWidth-3,5, Player.PLAYER2));
		player2UnitList.add(new FootSoldier(worldWidth-1,7, Player.PLAYER2));
		player2UnitList.add(new Tank(worldWidth-1,5, Player.PLAYER2));
		addUnitsToTiles();
		currentPlayerUnitList = player1UnitList;
		
		
	}
	
}


